/*
 * @Description: 
 * @Version: 2.0
 * @Autor: 刘世琪
 * @Date: 2021-01-08 16:11:16
 * @LastEditors: Seven
 * @LastEditTime: 2021-03-16 14:24:10
 */
import Vue from 'vue'
import Router from 'vue-router'
import User_update from '@/views/user/User_update'

Vue.use(Router)

var routes = [
        // {
        //   path:'/',
        //   name:'index',
        //   component:index
        // },
        {
          path:'/myindex',
          name:'myindex',
          component:() => import('@/components/myindex')       
        },
        {
          path:'/',  // 首页
          name:'Indexs',
          component:() => import('@/components/Indexs')       
        },
        // {
        //   path:'/user',  // 个人中心
        //   name:'User',
        //   component:() => import('@/components/User')       
        // },
        {
          path:'/my_home',  // 个人中心 新版
          name:'My_Home',
          component:() => import('@/components/My_Home'),
          // 拦截器使用
          beforeEnter: (to, from, next) => {
            
            if(localStorage.getItem("username")){
              console.log('登录');
              next()
            }else{
              next('/my_login')
            }
          }       
        },
        {
          path:'/user_upload',  // 图片展示
          name:'User_Upload',
          component:() => import('@/components/User_Upload')       
        },
        {
          path:'/header',  // 头部
          name:'Header',   
          component:() => import('@/components/Header')
        },
        {
          path:'/body',  // 身部
          name:'Body',   
          component:() => import('@/components/Body')
        },

        {
          path:'/footer',  // 页脚
          name:'Footer',   
          component:() => import('@/components/Footer')
        },
        {
          path:'/my_reg',  // 注册
          name:'Myreg',   
          component:() => import('@/components/Myreg')
        },
        {
          path:'/ant_reg',  // 新版注册
          name:'Ant_Reg',   
          component:() => import('@/components/Ant_Reg')
        },
        {
          path:'/my_back',  // 管理
          name:'My_back',   
          component:() => import('@/components/My_back'),
          children:[
            {
              path:'/user',  // 个人信息
              name:'User',
              component:() => import('@/views/user/User')  
            },
            {
              path:'/user_list',  // 用户中心
              name:'User_List',
              component:() => import('@/views/user/User_List')  
            },
            {
              path:'/user_update',  // 用户信息编辑
              name:'User_update',
              component:() => import('@/views/user/User_update')  
            },
            {
              path:'/uer_admin',  // 用户权限
              name:'Uer_Admin',
              component:() => import('@/views/user/Uer_Admin')  
            },
            {
              path:'/role',  // 用户权限
              name:'Role',
              component:() => import('@/views/user/Role')  
            },
            {
              path:'/role_list',  // 用户权限
              name:'Role_List',
              component:() => import('@/views/user/Role_List')  
            },
            {
              path:'/order',  // 用户权限
              name:'Order',
              component:() => import('@/views/work/Order')  
            },
            
          ]
        },
        {
          path:'/admin_login',  // 后端登录
          name:'Admin_login',
          component:() => import('@/views/admin/Admin_login')  
        },
        {
          path:'/my_login',  // 登录
          name:'My_Login',   
          component:() => import('@/components/My_Login')
        },
        {
          path:'/ant_login',  // 新版登录
          name:'Ant_Login',   
          component:() => import('@/components/Ant_Login')
        },
        {
          path:'/headers',
          name:'Headers',   
          component:() => import('@/components/Headers')
        },
        {
          path:'/footers',
          name:'Footers',   
          component:() => import('@/components/Footers')
        },
        {
          path:'/footers',
          name:'Footers',   
          component:() => import('@/components/Footers')
        },
        {
          path:'/ding_login',
          name:'DingDing',   
          component:() => import('@/views/user/DingDing')
        },
      
       

        
       
       
]

export default new Router({
  routes:routes,
  mode:'history'   /*hash*/
})


